#include "Audio.h"
#include "Arduino.h"
#include "Mp3.h"

Audio audio;
#define I2S_DOUT 25
#define I2S_BCLK 27
#define I2S_LRC 26
#define max_volume 21
#define mini_volume 0

int volume = 10;

void Audio_Play_Init() {
  audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
  audio.setVolume(volume);  // 0...21
  playNextAudio();
  // audio.connecttoFS(SD, "/song/1.mp3");
}

void Audio_Speak() {
  audio.setVolume(max_volume);
  audio.connecttoFS(SD, "/voice.mp3");
  audio.setVolume(volume);
}

void add_volume() {
  volume += 2;
  if (volume > max_volume) volume = max_volume;
  audio.setVolume(volume);
}

void dec_volume() {
  volume -= 2;
  if (volume < mini_volume) volume = mini_volume;
  audio.setVolume(volume);
}
